<template>
  <div>
    <button @click="getdata">get</button><br />
    <input type="text" v-model="keyword" />
    <button @click="getdatabyparams">带参get</button>
  </div>
</template>

<script>
//1.0引入axios
import axios from "axios";
export default {
  data() {
    return {
      keyword: "",
    };
  },
  methods: {
    getdata() {
      axios
        .get("http://157.122.54.189:9083/post")
        .then(function (res) {
          console.log(res);
        })
        .catch(function (err) {
          console.log(err);
        });
    },
    getdatabyparams() {
      axios
        .get("http://157.122.54.189:9083/post_search", {
          params: { keyword: this.keyword },
        })
        .then(function (res) {
          console.log(res);
          console.log(1);
        })
        .catch(function (err) {
          console.log(err);
        });
    },
  },
};
</script>

<style>
</style>